package com.kangtu.demoaskpager.ask.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kangtu.demoaskpager.ask.entity.TbAnswer;
import com.kangtu.demoaskpager.ask.mapper.TbAnswerMapper;
import com.kangtu.demoaskpager.ask.service.ITbAnswerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kangtu.demoaskpager.util.ResponseResult;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 标准答案表 服务实现类
 * </p>
 *
 * @author david
 * @since 2021-03-23
 */
@Service
public class TbAnswerServiceImpl extends ServiceImpl<TbAnswerMapper, TbAnswer> implements ITbAnswerService {

    @Override
    public ResponseResult getAnswerByAskId(Long askId) {
        ResponseResult result = ResponseResult.SUCCESS();

        List<TbAnswer> list = list(new QueryWrapper<TbAnswer>().lambda().eq(TbAnswer::getAskId, askId));

        result.setResult(list);

        return result;
    }
}
